package com.gofun.report.util;

import java.util.Date;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.gofun.common.mq.vo.CarControlVo;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath*:applicationContext*.xml" })
public class MongoTest {
	
	@Resource
	private MongoTemplate mongoTemplate;
	
	@Test
	public void mongo(){
//		mongoTemplate.dropCollection("test_coll");
//		mongoTemplate.createCollection("test_coll");
//		PushLog log = new PushLog();
//		log.setId("1233213");
//		log.setCarNo("1233213");
//		log.setCreateTime(new Date());
//		mongoTemplate.insert(logger, "test_coll");
//		List<PushLog> findAll = mongoTemplate.findAll(PushLog.class,"test_coll" );
		
//		Foo foo = new Foo();
//		foo.setName("little魏6");
//		foo.setAge(6);
//		mongoTemplate.insert(foo, "foo");
		CarControlVo vo = new CarControlVo();
		vo.setAction(1);
		vo.setDeviceNum("1");
		vo.setEndTime(new Date());
		vo.setStartTime(new Date());
		vo.setFrom("test");
		vo.setLpNum("1");
		vo.setSim("11111111111");
		vo.setStartTime(new Date());
		vo.setUserName("test");
		vo.setResult(true);
		vo.setCause("11");
		vo.setTermiType(1);
		vo.setCode(200);
		
		mongoTemplate.insert(vo, "carControl");
		
		
	}
}
